package com.project.service.impl;

import com.project.service.IContry;
import com.project.service.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

@Service
//@Scope("prototype")
public class ManServiceImpl implements IManService {
    @Resource(name = "zh")
    private IContry contry;
    //将属性文件中，name键对应的值赋给当前属性
    @Value("${name}")
    private String name;

    @PostConstruct
    public  void init(){
        System.out.println("初始化方式");
    }

    @PreDestroy
    public void del(){
        System.out.println("销毁");
    }

    @Override
    public void run() {
        System.out.println("奔跑，"+name);
        contry.bulid();
    }
}
